<?php
Util::tsRegisterAssetJs('form.js');
/** @var ValoresNutricionalesController $this */
/** @var ValoresNutricionales $model */
/** @var AweActiveForm $form */
Util::tsRegisterAssetJs('helper.js');
$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
    'type' => 'horizontal',
    'id' => 'valores-nutricionales-form',
    'enableAjaxValidation' => false,
    'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false,),
    'enableClientValidation' => true,
        ));
?>

<div class="row-fluid">
    <div class="span10">
        <?php
        $this->beginWidget('zii.widgets.CPortlet', array(
            'title' => ($model->isNewRecord ? Yii::t('AweCrud.app', 'Registrar') : Yii::t('AweCrud.app', 'Update')) . ' ' . ValoresNutricionales::label(2),
        ));
        ?>
        <p class="note">
            <?php echo Yii::t('AweCrud.app', 'Fields with') ?>
            <span class="required">*</span>
            <?php echo Yii::t('AweCrud.app', 'are required') ?> 
        </p>
        <div class="row-fluid">
            <div class="span5">
                <?php
                if ($model->isNewRecord) {
                    $listaAlimentos = Alimentos::model()->sin_valores_nutricionales()->ordenAsc()->findAll();
                } else {
                    $listaAlimentos = Alimentos::model()->findAllByAttributes(array('id' => $model->alimentos_id));
                }

                echo $form->dropDownListRow($model, 'alimentos_id', array('' => ' -- Seleccione -- ') + CHtml::listData($listaAlimentos, 'id', Alimentos::representingColumn()))
                ?>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'energia_kcal', array('maxlength' => 6)) ?>
            </div>
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'proteinas_g', array('maxlength' => 6)) ?>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'grasa_total_g', array('maxlength' => 6)) ?>
            </div>
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'carbohidratos_g', array('maxlength' => 6)) ?>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'fibra_dietetica_g', array('maxlength' => 6)) ?>
            </div>
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'calcio_mg', array('maxlength' => 6)) ?>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'fosforo_mg', array('maxlength' => 6)) ?>
            </div>
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'hierro_mg', array('maxlength' => 6)) ?>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'tiamina_mg', array('maxlength' => 3)) ?>
            </div>
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'riboflavina_mg', array('maxlength' => 3)) ?>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'niacina_mg', array('maxlength' => 6)) ?>
            </div>
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'vitamina_c_mg', array('maxlength' => 6)) ?>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'vitamina_a_eqiv_retinol_mcg', array('maxlength' => 6)) ?>
            </div>
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'acidos_grasos_monoinsat_g', array('maxlength' => 6)) ?>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'acidos_grasos_poliinsaturad_g', array('maxlength' => 6)) ?>
            </div>
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'acidos_grasos_saturados_g', array('maxlength' => 6)) ?>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'colesterol_mg', array('maxlength' => 6)) ?>
            </div>
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'potasio_mg', array('maxlength' => 6)) ?>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'sodio_mg', array('maxlength' => 6)) ?>
            </div>
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'zinc_mg', array('maxlength' => 6)) ?>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'magnesio_mg', array('maxlength' => 6)) ?>
            </div>
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'vitamina_b6_mg', array('maxlength' => 6)) ?>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'vitamina_b12_mcg', array('maxlength' => 6)) ?>
            </div>
            <div class="span5">
                <?php echo $form->textFieldRow($model, 'folato_mcg', array('maxlength' => 6)) ?>
            </div>
        </div>

        <div class="form-actions">
            <?php
            $this->widget('bootstrap.widgets.TbButton', array(
                'buttonType' => 'submit',
                'type' => 'primary',
                'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
            ));
            ?>
            <?php
            $this->widget('bootstrap.widgets.TbButton', array(
                //'buttonType'=>'submit',
                'label' => Yii::t('AweCrud.app', 'Cancel'),
                'htmlOptions' => array('onclick' => 'javascript:history.go(-1)')
            ));
            ?>
        </div>

        <?php $this->endWidget(); ?>
    </div>
    <?php $this->endWidget(); ?>
    <div class="span2">
        <?php
        $this->beginWidget('zii.widgets.CPortlet', array(
            'title' => Yii::t('AweCrud.app', 'Operaciones'),
        ));
        $this->widget('zii.widgets.CMenu', array(
            'items' => $this->menu,
            'htmlOptions' => array('class' => 'operations'),
        ));
        ?>
        <?php $this->endWidget(); ?>
    </div>
</div>